package com.ruoyi.logisticsmaster.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.logisticsmaster.domain.Logisticsmaster;
import com.ruoyi.logisticsmaster.service.ILogisticsmasterService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 物流订单Controller
 * 
 * @author sqlstudent
 * @date 2025-06-20
 */
@RestController
@RequestMapping("/logisticsmaster/logisticsmaster")
public class LogisticsmasterController extends BaseController
{
    @Autowired
    private ILogisticsmasterService logisticsmasterService;

    /**
     * 查询物流订单列表
     */
    @PreAuthorize("@ss.hasPermi('logisticsmaster:logisticsmaster:list')")
    @GetMapping("/list")
    public TableDataInfo list(Logisticsmaster logisticsmaster)
    {
        startPage();
        List<Logisticsmaster> list = logisticsmasterService.selectLogisticsmasterList(logisticsmaster);
        return getDataTable(list);
    }

    /**
     * 导出物流订单列表
     */
    @PreAuthorize("@ss.hasPermi('logisticsmaster:logisticsmaster:export')")
    @Log(title = "物流订单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Logisticsmaster logisticsmaster)
    {
        List<Logisticsmaster> list = logisticsmasterService.selectLogisticsmasterList(logisticsmaster);
        ExcelUtil<Logisticsmaster> util = new ExcelUtil<Logisticsmaster>(Logisticsmaster.class);
        util.exportExcel(response, list, "物流订单数据");
    }

    /**
     * 获取物流订单详细信息
     */
    @PreAuthorize("@ss.hasPermi('logisticsmaster:logisticsmaster:query')")
    @GetMapping(value = "/{logisticsId}")
    public AjaxResult getInfo(@PathVariable("logisticsId") String logisticsId)
    {
        return success(logisticsmasterService.selectLogisticsmasterByLogisticsId(logisticsId));
    }

    /**
     * 新增物流订单
     */
    @PreAuthorize("@ss.hasPermi('logisticsmaster:logisticsmaster:add')")
    @Log(title = "物流订单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Logisticsmaster logisticsmaster)
    {
        return toAjax(logisticsmasterService.insertLogisticsmaster(logisticsmaster));
    }

    /**
     * 修改物流订单
     */
    @PreAuthorize("@ss.hasPermi('logisticsmaster:logisticsmaster:edit')")
    @Log(title = "物流订单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Logisticsmaster logisticsmaster)
    {
        return toAjax(logisticsmasterService.updateLogisticsmaster(logisticsmaster));
    }

    /**
     * 删除物流订单
     */
    @PreAuthorize("@ss.hasPermi('logisticsmaster:logisticsmaster:remove')")
    @Log(title = "物流订单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{logisticsIds}")
    public AjaxResult remove(@PathVariable String[] logisticsIds)
    {
        return toAjax(logisticsmasterService.deleteLogisticsmasterByLogisticsIds(logisticsIds));
    }
}
